<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .box {
        width: 300px;
        height: 300px;
        background-color: cyan;
        margin: 200px auto;
        text-align: center;
        line-height: 300px;
        display: none;
    }
</style>

<body>
    <div class="box">
        喜欢的话 就点我吧
    </div>
</body>
<script>
    var box = document.getElementsByClassName('box')[0];
    yanchi();
    guanbi();
    function yanchi() {
        setTimeout(function () {
            box.style.display = 'block';
        }, 2000)
    }
    function guanbi() {
        setTimeout(function () {
            box.style.display = 'none';
        }, 5000)
    }
</script>

</html>